﻿#ifndef B7CUTMAINWINDOW_H
#define B7CUTMAINWINDOW_H

#include "mainwindow.h"
#include "DockWidgetInfo.h"
#include "RobotVision/UDPListener.h"
#include "RobotVision/B7CutPanelMatcher.h"
#include "RobotVision/SQLiteLog.h"
#include "RobotVision/plccomm.h"

class B7CutMainWindow : public MainWindow
{
    Q_OBJECT
public:
    B7CutMainWindow(QWidget *parent = nullptr);
private slots:
    void onDetect(); // 响应界面上的检测按键
    void onLoadRecipe(); // 响应界面上的加载 Recipe 的按键

    void updateRecipeAndDetect(int RobotNo, QString recipe, QString leftid, QString rightid);// 响应 m_matcher 的 trigger 信号
    void updateRecipeAndDetect2();// 这里拍照检测。之所以分两步是中间要等1s
    void offsetDisable(int robotNo);
    void robotDataUpload(int robot);
private:
    void updateRobotData(int robot);
    void afterDetect(int robotNo);
    void picSave(int channel, QString name);
    void writeLog(int robotNo);
    void initInfoDockWidget();
    void initRobotComm(QSettings &settings);
    DockWidgetInfo * m_InfoDockWidget[2];
    B7CutPanelMatcher m_matcher[2];

    bool m_WaitForDetect[2];
    QString m_recipeName[2];
    int m_panelNumber[2];

    PlcComm *m_pPlcComm;

    SQLiteLog sqlLogger;
};



#endif // B7CUTMAINWINDOW_H
